package com.itrus.spring.dependency;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author : peigen
 * @since: 2023/11/24 17:04
 */
public class CircularDependency {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(HelloService.class);
        context.register(LoggingAspect.class);
        context.refresh();
        /**
         * AbstractAutowireCapableBeanFactory.doCreateBean 方法中：
         * 如果对象在属性注入过程（populateBean）中被修改，并且当前 bean 会被注入到其他的 bean
         */
        HelloService helloService = context.getBean(HelloService.class);
        helloService.hello();
    }
}
